/**
 * Copyright &copy; 2012-2014 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
 */
package com.thinkgem.jeesite.modules.gen.entity;

import java.util.Date;

import org.hibernate.validator.constraints.Length;

import com.thinkgem.jeesite.common.persistence.DataEntity;
import com.thinkgem.jeesite.common.utils.StringUtils;

/**
 * 一对多模块Entity
 * @author wrong
 * @version 2016-08-02
 */
public class GenTableFk extends DataEntity<GenTableFk> {
	
	private static final long serialVersionUID = 1L;
	private GenTable genTable;
	private String genTableId;		// 归属表编号
	private String parentTable;		// 关联父表
	private String parentTableFk;		// 关联外键
	private Date beginUpdateDate;		// 开始 更新日期
	private Date endUpdateDate;		// 结束 更新日期
	
	public GenTableFk() {
		super();
	}

	public GenTableFk(String id){
		super(id);
	}
	
	public GenTableFk(GenTable genTable){
		this.genTable=genTable;
	}

	public GenTable getGenTable() {
		return genTable;
	}

	public void setGenTable(GenTable genTable) {
		this.genTable = genTable;
	}

	@Length(min=0, max=64, message="归属表编号长度必须介于 0 和 64 之间")
	public String getGenTableId() {
		return genTableId;
	}

	public void setGenTableId(String genTableId) {
		this.genTableId = genTableId;
	}
	
	@Length(min=0, max=200, message="关联父表长度必须介于 0 和 200 之间")
	public String getParentTable() {
		return parentTable;
	}

	public void setParentTable(String parentTable) {
		this.parentTable = parentTable;
	}
	
	@Length(min=0, max=100, message="关联外键长度必须介于 0 和 100 之间")
	public String getParentTableFk() {
		return parentTableFk;
	}

	public void setParentTableFk(String parentTableFk) {
		this.parentTableFk = parentTableFk;
	}
	
	public Date getBeginUpdateDate() {
		return beginUpdateDate;
	}

	public void setBeginUpdateDate(Date beginUpdateDate) {
		this.beginUpdateDate = beginUpdateDate;
	}
	
	public Date getEndUpdateDate() {
		return endUpdateDate;
	}

	public void setEndUpdateDate(Date endUpdateDate) {
		this.endUpdateDate = endUpdateDate;
	}
	
	/**
	 * 是否存在父类
	 * @return
	 */
	public Boolean getParentExists(){
		return genTableId != null && StringUtils.isNotBlank(parentTable) && StringUtils.isNotBlank(parentTableFk);
	}
}